<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书借阅系统 - 首页</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f8f9fa;
        }
        .navbar-brand {
            font-weight: bold;
        }
        .book-card {
            transition: transform 0.3s;
            height: 100%;
        }
        .book-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .book-cover {
            height: 200px;
            background-color: #e9ecef;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6c757d;
        }
        .hero-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 60px 0;
            margin-bottom: 40px;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="/">
                <i class="fas fa-book"></i> 图书借阅系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="/">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/about">关于我们</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/contact">联系我们</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="/reader/login">读者登录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/reader/register">读者注册</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/admin/login">管理员登录</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 英雄区域 -->
    <div class="hero-section">
        <div class="container text-center">
            <h1 class="display-4 mb-4">欢迎来到图书借阅系统</h1>
            <p class="lead mb-4">发现知识的海洋，开启阅读之旅</p>
            <div class="row justify-content-center">
                <div class="col-md-6">
                    <form action="/book/search" method="get" class="d-flex">
                        <input type="text" name="title" class="form-control me-2" placeholder="搜索图书...">
                        <button type="submit" class="btn btn-light">
                            <i class="fas fa-search"></i> 搜索
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- 图书展示 -->
    <div class="container">
        <h2 class="mb-4">热门图书</h2>
        <div class="row">
            <c:forEach items="${books}" var="book" begin="0" end="11">
                <div class="col-md-3 mb-4">
                    <div class="card book-card">
                        <div class="book-cover">
                            <i class="fas fa-book fa-3x"></i>
                        </div>
                        <div class="card-body">
                            <h5 class="card-title">${book.title}</h5>
                            <p class="card-text text-muted">${book.author}</p>
                            <p class="card-text">
                                <small class="text-muted">ISBN: ${book.isbn}</small><br>
                                <small class="text-success">可借: ${book.availableQuantity}/${book.totalQuantity}</small>
                            </p>
                            <a href="/book/detail/${book.id}" class="btn btn-primary btn-sm">查看详情</a>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </div>
        
        <div class="text-center mt-4">
            <a href="/book/list" class="btn btn-outline-primary">查看全部图书</a>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="bg-dark text-light mt-5 py-4">
        <div class="container text-center">
            <p>&copy; 2024 图书借阅系统. 保留所有权利.</p>
        </div>
    </footer>

    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/js/bootstrap.bundle.min.js"></script>
</body>
</html>